package com.muse.designpatterns.chain;

import com.google.common.collect.Lists;

import java.util.List;

public class ChainTest {
    private static List<Email> emails = Lists.newArrayList(new Email(EmailType.FANS_EMAIL.type,"粉丝A"),
    new Email(EmailType.COOPERATE_EMAIL.type,"合作"),
    new Email(EmailType.GARBAGE_ENAIl.type,"垃圾"),
    new Email(EmailType.FANS_EMAIL.type,"粉丝B"));

    public static void main(String[] args) {
        AbstractProcessor ceoProcessor = new CeoProcessor();
        AbstractProcessor lawProcessor = new LawProcessor();
        AbstractProcessor GarbageProcessor = new GarbageProcessor();
        AbstractProcessor businessProcessor= new BusinessProcessor();

        ceoProcessor.setNextProcessor(lawProcessor);
        lawProcessor.setNextProcessor(businessProcessor);
        businessProcessor.setNextProcessor(GarbageProcessor);

        ceoProcessor.handleMessage(emails);
    }
}
